package com.azzcs.blog.controller;

import com.azzcs.blog.entity.Article;
import com.azzcs.blog.service.ArticleService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Author: wzg
 * @Date: 2021/1/1 下午8:14
 */
@Controller
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    private ArticleService articleService;


    @GetMapping("list")
    public String index(Model model,
                        @RequestParam(defaultValue = "1") Long pageNum,
                        @RequestParam(defaultValue = "3") Long size){
        Page<Article> page = articleService.selectPage(pageNum, size);
        model.addAttribute("page",page);
        return "client/index";
    }
}
